fix: bin/ 스크립트 경로를 __file__ 기준으로 해석하여 cwd 무관하게 동작#708
Merged
Conversation
convert_all.py and fetch_cli.py (via Config) used relative paths like "var/pages.yaml" which broke when invoked from outside confluence-mdx/. Now all default paths resolve against the script's project root (confluence-mdx/) regardless of the working directory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
convert_all.py, fetch/config.py 외 나머지 bin/ 스크립트들도
__file__ 기반으로 프로젝트 루트를 결정하여 cwd에 무관하게 동작하도록 개선.
- restore_alt_from_diff.py: _REPO_ROOT 기준 git 명령 실행 및 파일경로 해석
- sync_confluence_url.py: 기본 디렉터리를 _REPO_ROOT 기준으로 해석
- skeleton/cli.py, diff.py, compare.py: target/ 기본 디렉터리를 _PROJECT_DIR 기준으로 해석
- skeleton/common.py: 절대경로에서도 target/{lang}/ 패턴 인식 (re.match → re.search)
- converter/cli.py: --public-dir 기본값을 _project_dir 기준으로 해석
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
모든 bin/ 스크립트의 경로 변수를 일관된 패턴으로 통일: - _SCRIPT_DIR (Path): confluence-mdx/bin/ - _PROJECT_DIR (Path): confluence-mdx/ - _REPO_ROOT (Path): repo root (필요한 스크립트만) 변경 파일: convert_all.py, converter/cli.py, fetch/config.py, skeleton/cli.py, skeleton/diff.py, skeleton/compare.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
사용자가 CLI로 명시한 --public-dir 경로는 cwd 기준 유지, 기본값(./public)만 _PROJECT_DIR 기준 절대경로로 설정. 테스트에서 상대경로로 --public-dir를 전달할 때 오작동하는 문제 수정. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
confluence-mdx/bin/하위 모든 CLI 스크립트의 기본 상대 경로가 CWD 기준으로 해석되어, 스크립트 위치와 다른 디렉터리에서 실행 시FileNotFoundError발생__file__기반으로_SCRIPT_DIR/_PROJECT_DIR/_REPO_ROOT를 계산하고, 기본 경로를 절대경로로 변환하도록 수정Path+ UPPERCASE 패턴으로 통일Changes
convert_all.py:_SCRIPT_DIR/_PROJECT_DIR+_resolve()헬퍼로 5개 경로 인자 resolvefetch/config.py:_PROJECT_DIR로default_output_dir,cache_dir,translations_fileresolveconverter/cli.py:_SCRIPT_DIR/_PROJECT_DIR추가,--public-dir기본값을 절대경로로 설정restore_alt_from_diff.py:_REPO_ROOT기준 git 명령 실행 및 diff 파일경로 해석sync_confluence_url.py:-r기본 디렉터리를_REPO_ROOT / src/content/{en,ja}로 해석skeleton/cli.py,diff.py,compare.py:target/기본 디렉터리를_PROJECT_DIR기준으로 해석skeleton/common.py:extract_language_code()등에서 절대경로 지원 (re.match→re.search)Test plan
python3 confluence-mdx/bin/convert_all.py --help실행 확인confluence-mdx/디렉터리 내에서 실행해도 동일하게 동작 확인🤖 Generated with Claude Code